﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
             xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
             xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:menu="clr-namespace:SilverlightContrib.Controls;assembly=CoolMenu"
             xmlns:local="clr-namespace:SilverlightSEO"
             xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             x:Class="SilverlightSEO.MainPage"
             d:DesignWidth="640"
             d:DesignHeight="480">

    <UserControl.Resources>

        <ControlTemplate x:Key="ValidationToolTipTemplate">
            <Grid x:Name="Root"
                  Margin="5,0"
                  Opacity="0"
                  RenderTransformOrigin="0,0">
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="OpenStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0" />
                            <VisualTransition GeneratedDuration="0:0:0.2"
                                              To="Open">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform"
                                                                   Storyboard.TargetProperty="X">
                                        <SplineDoubleKeyFrame KeyTime="0:0:0.2"
                                                              Value="0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root"
                                                                   Storyboard.TargetProperty="Opacity">
                                        <SplineDoubleKeyFrame KeyTime="0:0:0.2"
                                                              Value="1" />
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualTransition>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Closed">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root"
                                                               Storyboard.TargetProperty="Opacity">
                                    <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Open">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform"
                                                               Storyboard.TargetProperty="X">
                                    <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root"
                                                               Storyboard.TargetProperty="Opacity">
                                    <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="1" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Grid.RenderTransform>
                    <TranslateTransform x:Name="xform"
                                        X="-25" />
                </Grid.RenderTransform>
                <Border Margin="4,4,-4,-4"
                        Background="#052A2E31"
                        CornerRadius="5" />
                <Border Margin="3,3,-3,-3"
                        Background="#152A2E31"
                        CornerRadius="4" />
                <Border Margin="2,2,-2,-2"
                        Background="#252A2E31"
                        CornerRadius="3" />
                <Border Margin="1,1,-1,-1"
                        Background="#352A2E31"
                        CornerRadius="2" />
                <Border Background="#FFDC000C"
                        CornerRadius="2" />
                <Border CornerRadius="2">
                    <TextBlock Margin="8,4,8,4"
                               MaxWidth="250"
                               UseLayoutRounding="false"
                               Foreground="White"
                               Text="{Binding (Validation.Errors)[0].ErrorContent}"
                               TextWrapping="Wrap" />
                </Border>
            </Grid>
        </ControlTemplate>

    </UserControl.Resources>
	<UserControl.Background>
		<StaticResource ResourceKey="MainBackground"/>
	</UserControl.Background>

    <Grid x:Name="LayoutRoot"
          Style="{StaticResource LayoutRootGridStyle}" Margin="0" Background="{StaticResource MainBackground}">
        <Grid.RowDefinitions>
            <RowDefinition Height="70" />
            <RowDefinition MinHeight="200" />
            <RowDefinition Height="70" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.22*" />
            <ColumnDefinition Width="0.78*" />
        </Grid.ColumnDefinitions>

        <Grid Style="{StaticResource NavigationOuterGridStyle}"
              Grid.ColumnSpan="2" Margin="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="70" />
                <RowDefinition Height="20" />
            </Grid.RowDefinitions>

            <Border Height="Auto" Margin="0,0,0,22" VerticalAlignment="Stretch" CornerRadius="5" BorderThickness="1,1,1,0" BorderBrush="Black">
        		<Grid x:Name="NavigationGrid"
        			Style="{StaticResource NavigationGridStyle}"
                  Height="Auto" VerticalAlignment="Stretch">

        			<!--<Border x:Name="LinksBorder"
                        Style="{StaticResource LinksBorderStyle}">
                    <StackPanel x:Name="LinksStackPanel"
                                Style="{StaticResource LinksStackPanelStyle}">

                        <HyperlinkButton x:Name="Link1"
                                         Style="{StaticResource LinkStyle}"
                                         NavigateUri="/Home"
                                         TargetName="ContentFrame"
                                         Content="{Binding ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}" />

                        <Rectangle x:Name="Divider1"
                                   Style="{StaticResource DividerStyle}" />

                        <HyperlinkButton x:Name="Link2"
                                         Style="{StaticResource LinkStyle}"
                                         NavigateUri="/About"
                                         TargetName="ContentFrame"
                                         Content="{Binding ApplicationStrings.AboutPageTitle, Source={StaticResource ResourceWrapper}}" />

                    </StackPanel>
                </Border>-->

        			<Grid.Background>
        				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        					<GradientStop Color="#FFA40008" Offset="0"/>
        					<GradientStop Color="#FF550004" Offset="1"/>
        				</LinearGradientBrush>
        			</Grid.Background>

        			<Border x:Name="BrandingBorder"
        				Style="{StaticResource BrandingBorderStyle}">
        				<StackPanel x:Name="BrandingStackPanel"
        					Style="{StaticResource BrandingStackPanelStyle}">
        					<TextBlock x:Name="ApplicationNameTextBlock"
        						Style="{StaticResource ApplicationNameStyle}"
        						Text="{Binding ApplicationStrings.ApplicationName, Source={StaticResource ResourceWrapper}}" />

        				</StackPanel>
        			</Border>

        		</Grid>

        	</Border>

            <Border x:Name="loginContainer"
                    Style="{StaticResource LoginContainerStyle}"
                    Margin="0"
                    VerticalAlignment="Bottom" Background="Black">
                <!-- LoginStatus will be added here in code behind. This is required for the designer view to work -->
            </Border>
        </Grid>

        <Border x:Name="ContentBorder"
                Style="{StaticResource ContentBorderStyle}"
                Grid.Column="1"
                Margin="0"
                Grid.Row="1"
                Background="{StaticResource ContentBackground}"
                BorderThickness="0" BorderBrush="{x:Null}">
            <navigation:Frame x:Name="ContentFrame"
                              Style="{StaticResource ContentFrameStyle}"
                              Source="/Home"
                              Navigated="ContentFrame_Navigated"
                              NavigationFailed="ContentFrame_NavigationFailed"
                              BorderThickness="0">
                <navigation:Frame.UriMapper>
                    <uriMapper:UriMapper>
                        <uriMapper:UriMapping Uri=""
                                              MappedUri="/Views/Home.xaml" />
                        <uriMapper:UriMapping Uri="/Page/{title}"
                                              MappedUri="/Views/Content.xaml?title={title}" />
                        <uriMapper:UriMapping Uri="/{pageName}"
                                              MappedUri="/Views/{pageName}.xaml" />
                    </uriMapper:UriMapper>
                </navigation:Frame.UriMapper>
            </navigation:Frame>
        </Border>
        <StackPanel Margin="0"
                    Grid.Row="1"
                    Background="{StaticResource ContentBackground}"
                    x:Name="NavigationPanel" HorizontalAlignment="Stretch" Width="Auto" MinWidth="150" MinHeight="250">
            <!--<ListBox x:Name="PagesListBox"
                     ItemsSource="{Binding Data, ElementName=PagesDomainDataSource, Mode=OneWay}"
                     Margin="3,5,3,0"
                     RenderTransformOrigin="0.5,0.5"
                     Foreground="#FF890208"
                     Background="#FFDDDDCC">

            </ListBox>

            <menu:CoolMenu x:Name="Menu"
                           Width="400"
                           Height="400"
                           MaxItemHeight="100"
                           MaxItemWidth="100">

                <menu:CoolMenu.Items>
                    <menu:CoolMenuItemCollection>
                        <menu:CoolMenuItem>
                            <menu:CoolMenuItem.Content>
                                <TextBlock Text="Test" />
                            </menu:CoolMenuItem.Content>
                        </menu:CoolMenuItem>
                    </menu:CoolMenuItemCollection>
                </menu:CoolMenu.Items>
            </menu:CoolMenu>-->

            <riaControls:DomainDataSource x:Name="PagesDomainDataSource"
                                          QueryName="GetPages"
                                          LoadDelay="00:01:10.7500000">
                <riaControls:DomainDataSource.DomainContext>
                    <local:SiteDomainContext  d:IsDataSource="True" />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
        </StackPanel>

        <Border Margin="0"
                BorderBrush="Black"
                BorderThickness="0,0,0,1"
                Grid.Row="3"
                Grid.ColumnSpan="2"
                CornerRadius="5" >
				<Border.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        				<GradientStop Color="#FF810006" Offset="1"/>
        				<GradientStop Color="#FF520004"/>
        			</LinearGradientBrush>
				</Border.Background>
        	<Rectangle Stroke="Black" Margin="0,0,0,5" StrokeThickness="0">
        		<Rectangle.Fill>
        			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        				<GradientStop Color="#FF810006" Offset="1"/>
        				<GradientStop Color="#FF520004"/>
        			</LinearGradientBrush>
        		</Rectangle.Fill>
        	</Rectangle>
        </Border>

    </Grid>

</UserControl>